export default {
  name: "PetList",
  data() {
    return {
      nav: '',
      claasify: '其他',
      homeinfo: ''
    }
  },
  methods: {
    //分类渲染
    navdata() {
      this.$axios({
        method: 'GET',
        url: "/api/nav",
      })
        .then(res => {
          this.nav = res.data.data
        })
    },
    //初始数据渲染暂定分类为猫咪
    initialdata() {
      this.$axios({
        method: 'GET',
        url: "/api/homeinfo",
        params:{
          claasify:this.claasify
        }
      })
        .then(res => {
          console.log(res.data)
          this.homeinfo = res.data.data
        })
    },
    //点击分类进行渲染
    homeinfodata(item){
      this.claasify=item.classifyInfo
      this.$axios({
        method: 'GET',
        url: "/api/homeinfo",
        params:{
          claasify:this.claasify
        }
      })
        .then(res => {
          console.log(res.data)
          this.homeinfo = res.data.data
        })
    }
  },
  created() {
    this.navdata()
    this.initialdata()
  }
};